﻿<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page import="com.xiaonei.api.schema.*"%>
<%@ page import="com.xiaonei.api.*"%>
<%@ page import="java.util.*"%>
<%
String session_key = request.getParameter("xn_sig_session_key");
 if(session_key==null||session_key.equals("")){
 		out.print("<script type=\"text/javascript\"> top.location.href=\"http://app.renren.com/apps/tos.do?v=1.0&api_key=bdb958de863b42a29bc02ae80897e618&next=http://apps.renren.com/jjj_abc/\"</script>");
		return;
	}
%>
<ul id="nav" style="WIDTH: 190px; HEIGHT: 266px; float:left">
<%
try{
	List uids=new ArrayList();
	XiaoneiRestClient client = new XiaoneiRestClient("bdb958de863b42a29bc02ae80897e618",
													 "da1a11681a814cb19244678c086b464b",
													  session_key);
    client.friends_getFriends();
    FriendsGetFriendsResponse resp = (FriendsGetFriendsResponse) client.getResponsePOJO();
    List<Friend> friends = resp.getFriend();
    for (Friend friend : friends) {
		
		uids.add(friend.getId());

    }
	
	
	
	

	
	EnumSet<ProfileField> enumFields = EnumSet.of(ProfileField.NAME,ProfileField.STAR,
				ProfileField.SEX,ProfileField.BIRTHDAY,
				ProfileField.HOMETOWN_LOCATION,ProfileField.UNIVERSITY_HISTORY,
				ProfileField.TINYURL,ProfileField.HEADURL,ProfileField.MAINURL,
				ProfileField.HS_HISTORY,
				ProfileField.WORK_HISTORY,ProfileField.UNIVERSITY_HISTORY,ProfileField.ZIDOU);
			client.users_getInfo(uids, enumFields);
		UsersGetInfoResponse loggedUserGetInfoRes = (UsersGetInfoResponse) client.getResponsePOJO();
		List<User> users = loggedUserGetInfoRes.getUser();
	for (User user : users) {
		HometownLocation hl = user.getHometownLocation();
		if((hl!=null)){
		out.print("<li><a href=\"javascript:void(0)\" onclick=\"JJJshowAddress('"+hl.getCity()+"','"+user.getTinyurl()+"','"+user.getName()+"',1);return false\" class=\"aimg\" title=\"查看"+user.getName()+"的个人主页\" style=\"background-image: url("+user.getTinyurl()+");\"></a>");
		out.print("<span class=\"lispan\">");
		out.print("<a class=\"renrena\" href=\"javascript:void(0)\" onclick=\"JJJshowAddress('"+hl.getCity()+"','"+user.getTinyurl()+"','"+user.getName()+"',1);return false\">"+user.getName()+"</a></span></li>");
			}else
			{
				out.print("<li><a href=\"javascript:void(0)\" onclick=\"JJJshowAddress(' ','"+user.getTinyurl()+"','"+user.getName()+"',1);return false\" class=\"aimg\" title=\"查看"+user.getName()+"的个人主页\" style=\"background-image: url("+user.getTinyurl()+");\"></a>");
				out.print("<span class=\"lispan\">");
				out.print("<a class=\"renrena\" href=\"javascript:void(0)\" onclick=\"JJJshowAddress(' ','"+user.getTinyurl()+"','"+user.getName()+"',1);return false\">"+user.getName()+"</a></span></li>");
			}
		}
}catch(Exception e)
{
	out.print("x_x,超时了~~~~");
}
%>
</ul>